import request from '@/utils/request'

// 查询课表列表
export function listCourseSchedule(query) {
  return request({
    url: '/academic/courseSchedule/list',
    method: 'get',
    params: query
  })
}

// 查询课表详细
export function getCourseSchedule(id) {
  return request({
    url: '/academic/courseSchedule/' + id,
    method: 'get'
  })
}

// 新增课表
export function addCourseSchedule(data) {
  return request({
    url: '/academic/courseSchedule',
    method: 'post',
    data: data
  })
}

// 修改课表
export function updateCourseSchedule(data) {
  return request({
    url: '/academic/courseSchedule',
    method: 'put',
    data: data
  })
}

// 删除课表
export function delCourseSchedule(id) {
  return request({
    url: '/academic/courseSchedule/' + id,
    method: 'delete'
  })
}

// 导出课表
export function exportCourseSchedule(query) {
  return request({
    url: '/academic/courseSchedule/export',
    method: 'post',
    data: query,
    responseType: 'blob'
  })
}

// 根据学期ID查询课表列表
export function getCourseScheduleBySemester(semesterId) {
  return request({
    url: '/academic/courseSchedule/semester/' + semesterId,
    method: 'get'
  })
}

// 根据日期范围查询课表列表
export function getCourseScheduleByDateRange(startDate, endDate) {
  return request({
    url: '/academic/courseSchedule/date-range',
    method: 'get',
    params: { startDate, endDate }
  })
}

// 获取教师课表
export function getTeacherSchedule(teacherId, semesterId) {
  return request({
    url: '/academic/courseSchedule/teacher/' + teacherId,
    method: 'get',
    params: { semesterId }
  })
}

// 获取班级课表
export function getClassSchedule(classId, semesterId) {
  return request({
    url: '/academic/courseSchedule/class/' + classId,
    method: 'get',
    params: { semesterId }
  })
}

// 获取教室课表
export function getClassroomSchedule(classroomId, semesterId) {
  return request({
    url: '/academic/courseSchedule/classroom/' + classroomId,
    method: 'get',
    params: { semesterId }
  })
}

// 获取学生课表
export function getStudentSchedule(studentId, semesterId) {
  return request({
    url: '/academic/courseSchedule/student/' + studentId,
    method: 'get',
    params: { semesterId }
  })
}